<include file="Public:header"/>
<div class="main main_grey">
	<div class="user_wrap">
		<form action="" method="post">
		<div class="form_user">
			<div class="tab_menu">
				<ul class="clearfix">
					<li class="menu1 cur"><a href="{:URL('Login/index', '', 'login')}">登录</a></li>
					<li class="menu2"><a href="{:URL('User/register', '', '/register')}">注册账号</a></li>
				</ul>
			</div>
			<div class="content">
				<div class="row">
					<span class="icon icon_user">&nbsp;</span>
					<span class="name none">邮箱或手机</span>
					<input type="text" name="mobile" placeholder="邮箱/手机" class="text" autocomplete="off"/>
					<p class="error_tips Validform_checktip"></p>
				</div>
				<div class="row">
					<span class="icon icon_psw">&nbsp;</span>
					<span class="name none">密码</span>
					<input type="password" name="password" placeholder="请输入密码" class="text" />
					<p class="error_tips Validform_checktip"></p>
				</div>
				<div class="row row_code" <eq name="is_show_imgcod" value="0">style="display: none"</eq>>
					<span class="icon icon_code">&nbsp;</span>
					<span class="name none">验证码</span>
					<input type="text" name="imgcode" placeholder="请输入验证码" class="text" />
					<a href="javascript:;" class="noneAjax"><img class="img-verify" href="{:U('imgcode', 'w=126&h=42')}" src="{:U('imgcode', 'w=126&h=42')}" /></a>
					<p class="error_tips Validform_checktip"></p>
				</div>
				<div class="clearfix operate">
					<div class="fl">
						<input type="checkbox" name="check" id="j_checkbox_check1" class="radio_vlign" />
						<label for="j_checkbox_check1">自动登录</label>	
					</div>
					<div class="fr">
						<a href="{:URL('User/forget_password', '', '/forget_password')}">忘记密码</a>
					</div>
				</div>
				<div class="submit">
					<input type="submit" name="" value="立即登录" class="btn" />
				</div>
			</div>
		</div>
		</form>
	</div>
</div>
<script type="text/javascript">
$(document).ready(function() {
	$('.img-verify').click(function () {
		var url = $(this).attr('href') + '?' + Math.random();
		$(this).attr('src', url);
		return false;
	});
	$("form").submit(function () {
		loading('正在登录，请稍候...');
		$('.submit input').val('正在登录，请稍候...');
		var url    = $(this).attr('action');
		var method = $(this).attr('method');
		var method = method ? method : 'post';
		var data   = $(this).serialize();
		$.ajax({
			url : url,
			data : data,
			type : method == 'post' ? 'post' : 'get',
			dataType:'json',
			success : function(json){
				removeLoading();
				if(json.status == 1){
					msgbox(json.info);
				}else{
					msgbox(json.info, 'error');
					if(json.data.is_show_imgcod){
						$('.row_code').show().find('img').attr('src', '{:U("imgcode", "w=126&h=42")}');
						$('.row_code input').attr('datatype', '*');
					}
				}
				//有返回链接，则跳转
				if(json.url){
					jumpurl(json.url);
				}
				$('.submit input').val('立即登录');
			},
			error : function () {
				removeLoading();
				msgbox('请求失败，请稍候再试！', 'error');
				$('.submit input').val('立即登录');
			}
		});
		return false;
	});
});
</script>
<include file="Public:footer"/>